/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.apli.haiam.ejb.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Informática
 */
@Entity
@Table(name = "hos_tipo_dieta")
@NamedQueries({
    @NamedQuery(name = "HosTipoDieta.findAll", query = "SELECT h FROM HosTipoDieta h")})
public class HosTipoDieta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "htd_id")
    private Integer htdId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 64)
    @Column(name = "htd_nombre")
    private String htdNombre;
    @Basic(optional = false)
    @NotNull
    @Column(name = "htd_estado")
    private int htdEstado;
    @ManyToMany(mappedBy = "hosTipoDietaList", fetch = FetchType.LAZY)
    private List<HosPedidoDieta> hosPedidoDietaList;
    @OneToMany(mappedBy = "hosTipoDieta", fetch = FetchType.LAZY)
    private List<HosTipoDieta> hosTipoDietaList;
    @JoinColumn(name = "hos_htd_id", referencedColumnName = "htd_id")
    @ManyToOne(fetch = FetchType.LAZY)
    private HosTipoDieta hosTipoDieta;

    public HosTipoDieta() {
    }

    public HosTipoDieta(Integer htdId) {
        this.htdId = htdId;
    }

    public HosTipoDieta(Integer htdId, String htdNombre, int htdEstado) {
        this.htdId = htdId;
        this.htdNombre = htdNombre;
        this.htdEstado = htdEstado;
    }

    public Integer getHtdId() {
        return htdId;
    }

    public void setHtdId(Integer htdId) {
        this.htdId = htdId;
    }

    public String getHtdNombre() {
        return htdNombre;
    }

    public void setHtdNombre(String htdNombre) {
        this.htdNombre = htdNombre;
    }

    public int getHtdEstado() {
        return htdEstado;
    }

    public void setHtdEstado(int htdEstado) {
        this.htdEstado = htdEstado;
    }

    public List<HosPedidoDieta> getHosPedidoDietaList() {
        return hosPedidoDietaList;
    }

    public void setHosPedidoDietaList(List<HosPedidoDieta> hosPedidoDietaList) {
        this.hosPedidoDietaList = hosPedidoDietaList;
    }

    public List<HosTipoDieta> getHosTipoDietaList() {
        return hosTipoDietaList;
    }

    public void setHosTipoDietaList(List<HosTipoDieta> hosTipoDietaList) {
        this.hosTipoDietaList = hosTipoDietaList;
    }

    public HosTipoDieta getHosTipoDieta() {
        return hosTipoDieta;
    }

    public void setHosTipoDieta(HosTipoDieta hosTipoDieta) {
        this.hosTipoDieta = hosTipoDieta;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (htdId != null ? htdId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HosTipoDieta)) {
            return false;
        }
        HosTipoDieta other = (HosTipoDieta) object;
        if ((this.htdId == null && other.htdId != null) || (this.htdId != null && !this.htdId.equals(other.htdId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.apli.haiam.ejb.entidades.HosTipoDieta[ htdId=" + htdId + " ]";
    }
    
}
